Exemplo n.º 1
0
        public void ModeChanged(object sender, EventArgs e)
        {
            if (IsEventsEnabled)
            {
                IsEventsEnabled = false;
                if (Properties.Settings.Default.CashModeAvailable && Properties.Settings.Default.KitchenModeAvailable)
                {
                    if (indicator != null)
                    {
                        indicator.DeleteView();
                        indicator = null;
                    }

                    Bitmap bitmap;
                    string bitmapPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\SWDocuments"; //���� � ����������
                    if (!Directory.Exists(bitmapPath + "\\"))
                        Directory.CreateDirectory(bitmapPath);

                    bitmapPath += "\\indicator.ind";

                    if (Properties.Settings.Default.CashModeOn && Properties.Settings.Default.KitchenModeOn)
                        bitmap = Furniture.Properties.Resources.GreenIndicator;
                    else
                        bitmap = Furniture.Properties.Resources.RedIndicator;

                    bitmap.Save(Path.GetFullPath(bitmapPath));

                    infoList.Items.Clear();
                    string status = Properties.Settings.Default.CashModeOn ? "���" : "����";
                    infoList.Items.Add("����� ���: " + status);
                    status = Properties.Settings.Default.KitchenModeOn ? "���" : "����";
                    infoList.Items.Add("����� ������: " + status);

                    if (File.Exists(bitmapPath))
                    {
                        indicator = _iSwApp.CreateTaskpaneView2(bitmapPath, "���������");
                        indicator.DisplayWindowFromHandle(infoList.Handle.ToInt32());
                    }

                    SwApp.ActivateTaskPane((int)swTaskPaneTab_e.swDesignLibrary);
                }
                IsEventsEnabled = true;
            }
        }