; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Моя программа"
#define MyAppVersion "1.6.2.0"
#define MyAppPublisher "ООО Бирюльки"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "NameOfMainExeFile.exe"
#define SetupName "setup_my_programm"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{390B67EF-46E4-45B6-B6F9-C9C6362FE337}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName="{pf}\MyProgramm"
DefaultGroupName={#MyAppName}
OutputBaseFilename={#SetupName}{#MyAppVersion}
Compression=lzma
SolidCompression=yes
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Files]
Source: "{#SourcePath}NDP461-KB3102436-x86-x64-AllOS-ENU.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall; Check: not DotNetFrameworkIsInstalled
Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\MyProgramm.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\GalaSoft.MvvmLight.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\System.Web.Razor.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}DopCalc\bin\Release\Templates\*"; DestDir: "{app}\Templates"; Flags: ignoreversion createallsubdirs recursesubdirs
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Filename: "{tmp}\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"; Parameters: "/passive /showfinalerror /norestart /x86 /x64"; Check: not DotNetFrameworkIsInstalled; StatusMsg: Microsoft Framework 4.6.1 устанавливается. Пожалуйста подождите...
[Code]
function DotNetFrameworkIsInstalled(): Boolean;
var
bSuccess: Boolean;
regVersion: Cardinal;
begin
Result := False;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion);
if (True = bSuccess) and (regVersion >= 394254) then begin
Result := True;
end;
end;
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
string[] dayOfWeek = new string[] { "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье" };
Console.WriteLine("Введите температуру воздуха за неделю: ");
var temp = new List<int>();
var r = new Random();
foreach(var day in dayOfWeek){
// Console.Write("{0,-12}: ", day);
// temp.Add(Convert.ToInt32(Console.ReadLine()));
temp.Add(r.Next(-10,10));
}
Console.WriteLine(string.Join(", ", temp));
Console.WriteLine();
//Для обычных людей
Console.WriteLine("Средняя температура за неделю: {0} градусов", temp.Average());
Console.WriteLine("Максимальная температура: {0} градус(-ов)", temp.Max());
Console.WriteLine("Минимальная температура: {0} градус(-ов)", temp.Min());
Console.WriteLine();
//Для студентов
{
double sum = 0;
for(int i = 0; i < temp.Count; i++){
sum += temp[i];
}
Console.WriteLine("Средняя температура за неделю: {0} градусов", sum / temp.Count);
}
{
int pos = 0, max = temp[0];
for(int i = 1; i < temp.Count; i++){
if(max < temp[i]){
pos = i;
max = temp[i];
}
}
Console.WriteLine("Максимальная температура: {0} градус(-ов) позиция {1}", max, pos+1);
}
{
int pos = 0, min = temp[0];
for(int i = 1; i < temp.Count; i++){
if(min > temp[i]){
pos = i;
min = temp[i];
}
}
Console.WriteLine("Минимальная температура: {0} градус(-ов) позиция {1}", min, pos+1);
}
}
}
public MainViewModel(Messenger messenger, ServiceDialog serviceDialog){...}
var uri = value as string;
if (string.IsNullOrWhiteSpace(uri))
return null;
var image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(uri);
if (Width != null)
image.DecodePixelWidth = (int)Width;
if (Height != null)
image.DecodePixelHeight = (int)Height;
image.EndInit();
return image;
var uri = value as string;
if (string.IsNullOrWhiteSpace(uri))
return null;
var source = new BitmapImage(new Uri(uri));
var image = new Image { Source = source };
if (Width != null)
image.Width = (int)Width;
if (Height != null)
image.Height = (int)Height;
return image;
interface ICore {...}
interface IDeviceManager {...}
class Core : ICore {...}
class DeviceManager : IDeviceManager{...}
public partial class MyMainForm
{
private LightInject.IServiceContainer _container;
public MyMainForm(LightInject.IServiceContainer container)
{
_container = container;
}
public void ShowDeviceWindow()
{
var form = _container.Create<MyDeviceForm>();
form.Show();
}
}
public partial class MyDeviceForm
{
private IDeviceManager _deviceManager;
public MyDeviceForm(IDeviceManager devicemanager)
{
_deviceManager = devicemanager;
}
public void ButtonClick()
{
// Здесь вы делаете все что хотите и работаете с менеджером
// Например загружаете список приборов в лист
foreach(var device in _deviceManager.GetDevices())
listBox.Add(device.ToString());
}
var container = new LightInject.ServiceContainer();
container.RegisterInstance<IServiceContainer>(container);
container.Register<ICore, Core>(new PerContainerLifetime());
container.Register<IDeviceManager, DeviceManager>(new PerContainerLifetime());
var form = container.Create<MyMainForm>();
//Не помню как выводятся окна в WinForms
//Но логика надеюсь понятна
form.Show();
manager.ShowWindow<MyDeviceForm>();
и всем окнам подсовывал бы его. Так проще контролировать создание окон.var list = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
PrintList(list);
bool delete = false;
while (list.Count > 1)
{
for (int i = 0; i < list.Count; i++)
{
if (delete) list.RemoveAt(i--);
delete = !delete;
}
PrintList(list);
}
Console.Read();
static void PrintList(IEnumerable<int> list)
{
foreach (var item in list)
Console.Write("{0} ", item);
Console.WriteLine();
}